function slope(e, t) {
    var n;
    return n = (t.y - e.y) / (t.x - e.x), n
}

var arrMouse = [],
        locMouse, preMouse, _parentNote = "",
        parentRightTop, parentRightBottom, _timeOut, _timeOutHide, _delay = 500,
        _this, _level;
$(function() {
    $(".mndrop").mouseover(function(e) {
        arrMouse.push({
            x: e.pageX,
            y: e.pageY
        }), arrMouse.length >= 3 && arrMouse.shift(), _this || (_this = $(this)), _level = _this.data("level") || 0, _parentNote = _this.parent(), x_top = _parentNote.offset().left + _parentNote.outerWidth(), y_top = _parentNote.offset().top, parentRightTop = {
            x: x_top,
            y: y_top
        }, x_bottom = _parentNote.offset().left + _parentNote.outerWidth(), y_bottom = _parentNote.offset().top + _parentNote.outerHeight(), parentRightBottom = {
            x: x_bottom,
            y: y_bottom
        }
    }).mouseenter(function() {
        locMouse = arrMouse[arrMouse.length - 1], preMouse = arrMouse[0], position_loc_top = slope(locMouse, parentRightTop), position_loc_bottom = slope(locMouse, parentRightBottom), position_pre_top = slope(preMouse, parentRightTop), position_pre_bottom = slope(preMouse, parentRightBottom), position_loc_top < position_pre_top && position_loc_bottom > position_pre_bottom ? (_timeOut && clearTimeout(_timeOut), _timeOut = setTimeout(function() {
            $(".sub").hide(), _this != null && _this.find(".sub").show()
        }, _delay)) : ($(".sub").hide(), _this.find(".sub").show())
    }).mouseout(function() {
        _this = null, _timeOutHide && clearTimeout(_timeOutHide), _timeOutHide = setTimeout(function() {
            _this || $(".sub").hide()
        }, _delay)
    })
});